<!DOCTYPE html>
<html lang="en" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="../layui/css/layui.css">
    <link rel="stylesheet" href="../css/custom.form.css">
    <style>
        .layui-form-label {
            width: 180px;
            padding: 9px 0px;
            text-align: center;
        }

        .layui-btn {
            padding: 0 10px;
        }

        .layui-input-block {
            margin-left: 150px;
        }

        .more-container {
            display: none;
        }
    </style>
</head>
<body>
<div class="panel panel-default operation" id="picture" hidden>
    <div class="panel-heading title"></div>
    <div class="layui-card-body">
        <form class="layui-form " action="" lay-filter="info" style="width: 1000px;margin-top: 10px;">
            <input name="tBBH" hidden/>
            <div class="layui-form-item" id="area-picker">
                <div class="layui-form-label" style="display: none">所在省/隐藏项</div>
                <div class="layui-input-inline" style="width: 200px; display: none">
                    <select name="province" class="province-selector" data-value="辽宁省" lay-filter="province-1"
                            style="display:none">
                        <option value="">请选择省</option>
                    </select>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">矿区所在市:</label>
                    <div class="layui-input-inline">
                        <select name="xZS" class="xZS-selector" data-value="沈阳市" lay-filter="xZS-1">
                            <option value="">请选择市</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">矿区所在县:</label>
                    <div class="layui-input-inline">
                        <select name="xZX" class="xZX-selector" data-value=" " lay-filter="xZX-1">
                            <option value="">请选择县/区</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">核定图斑面积:</label>
                    <div class="layui-input-inline">
                        <input type="hDMJ" id="hDMJ" name="hDMJ" placeholder="浮点型保留6位小数" autocomplete="off"
                               class="layui-input" lay-verify="required|A">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">图斑位置:</label>
                    <div class="layui-input-inline">
                        <input type="text" id="wZ" name="wZ" placeholder="精确到乡镇" autocomplete="off"
                               class="layui-input" lay-verify="required">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">中心点经度:</label>
                    <div class="layui-input-inline">
                        <input type="text" id="kFX" name="kFX" placeholder="浮点型保留6位小数" autocomplete="off"
                               class="layui-input" lay-verify="required|B">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">中心点纬度:</label>
                    <div class="layui-input-inline">
                        <input type="text" id="kFY" name="kFY" placeholder="浮点型保留6位小数" autocomplete="off"
                               class="layui-input" lay-verify="required|C">
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">复垦义务人:</label>
                    <div class="layui-input-inline">
                        <input type="text" id="fKYWR" name="fKYWR" placeholder="请输入填写矿山的复垦义务人，如无法获取则填“无”"
                               autocomplete="off"
                               class="layui-input" lay-verify="required">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">损毁原因:</label>
                    <div class="layui-input-inline">
                        <input type="sTWT" id="sTWT" name="sTWT" hidden/>
                        <select class="layui-select" lay-filter="select-sTWT" lay-verify="required">
                            <option value="TDSH">土地损毁（含挖损、压占、塌陷土地）</option>
                            <option value="DZHJWT">地质环境问题（地面塌陷、地裂缝、崩塌、滑坡体等）</option>
                            <option value="ZBPH">植被破坏</option>
                        </select>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">治理状态:</label>
                    <div class="layui-input-inline">
                        <input type="zLQK" id="zLQK" name="zLQK" hidden/>
                        <select class="layui-select" lay-filter="select-zLQK" lay-verify="required">
                            <option value="WZL">未修复</option>
                            <option value="YHFZL">正在修复</option>
                            <option value="ZZZL">已修复完成</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">治理面积:</label>
                    <div class="layui-input-inline">
                        <input type="text" name="zLMJ" placeholder="请输入实地核查测量的治理面积" autocomplete="off"
                               class="layui-input" lay-verify="required|D">
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">拟修复时间:</label>
                    <div class="layui-input-inline">
                        <input type="nXFSJ" id="nXFSJ" name="nXFSJ" placeholder="请输入修复的时间" autocomplete="off"
                               class="layui-input" lay-verify="required">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">现场照片:</label>
                    <div class="layui-input-inline">
                        <input type="text" name="xCZP" placeholder="请输入核查现场的照片存储地址" autocomplete="off"
                               class="layui-input" lay-verify="required">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">核查单位名称:</label>
                    <div class="layui-input-inline">
                        <input type="text" name="hCDW" placeholder="请输入核查单位名称" autocomplete="off" class="layui-input"
                               lay-verify="required">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">核查人员姓名:</label>
                    <div class="layui-input-inline">
                        <input type="text" name="hCRY" placeholder="请输入核查人员姓名" autocomplete="off" class="layui-input"
                               lay-verify="required">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">核查具体日期:</label>
                    <div class="layui-input-inline">
                        <input type="text" name="hCRQ" id="hCRQ" placeholder="请输入核查具体日期" autocomplete="off"
                               class="layui-input" lay-verify="required">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">实施主体</label>
                    <div class="layui-input-inline">
                        <input type="text" id="sSZT" name="sSZT" placeholder="请输入治理/复垦工程实施单位" autocomplete="off"
                               class="layui-input" lay-verify="required">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">复垦/治理时间</label>
                    <div class="layui-input-inline">
                        <input type="text" id="fKSJ" name="fKSJ" placeholder="请选择治理/复垦时间" autocomplete="off"
                               class="layui-input" lay-verify="required">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">验收时间</label>
                    <div class="layui-input-inline">
                        <input type="text" id="ySSJ" name="ySSJ" placeholder="请选择验收时间" autocomplete="off"
                               class="layui-input" lay-verify="required">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">组织验收单位</label>
                    <div class="layui-input-inline">
                        <input type="text" id="ySDW" name="ySDW" placeholder="请输入验收单位" autocomplete="off"
                               class="layui-input" lay-verify="required">
                    </div>
                </div>
            </div>
            <div class="layui-form-item" id="area-type">
                <div class="layui-form-label" style="display: none">所在省/隐藏项</div>
                <div class="layui-input-inline" style="width: 200px; display: none">
                    <select name="one" class="one-selector" data-value="用地" lay-filter="one-1" style="display:none">
                        <option value=""></option>
                    </select>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">治理/复垦后土地利用类型</label>
                    <div class="layui-input-inline">
                        <div class="layui-input-inline">
                            <select name="yDFL" class="yDFL-selector" data-value="农用地" lay-filter="yDFL-1">
                                <option value="">请选择分类类型</option>
                            </select>
                        </div>
                    </div>
                    <!--</div>-->
                    <!--<div class="layui-inline">-->
                    <label class="layui-form-label"> </label>
                    <div class="layui-input-inline">
                        <select name="fKFX" class="fKFX-selector" data-value="0101水浇地" lay-filter="fKFX-1">
                            <option value="">请土地利用类型</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">验收结论</label>
                    <div class="layui-input-inline">
                        <input type="ySJL" id="ySJL" name="ySJL" hidden/>
                        <select class="layui-select" lay-filter="select-ySJL" lay-verify="required">
                            <option value="TG">通过</option>
                            <option value="YTJTG">有条件通过</option>
                            <option value="WTG">未通过</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">总体投资</label>
                    <div class="layui-input-inline">
                        <input type="text" id="zTTZ" name="zTTZ" placeholder="请输入总体投资金额（万元）" autocomplete="off"
                               class="layui-input" lay-verify="required|E">
                    </div>
                </div>
            </div>
            <div class="layui-form-item" style="text-align: center;">
                <div class="layui-input-block">
                    <button type="submit" class="layui-btn" lay-submit="" lay-filter="submit">保存</button>
                    <button class="layui-btn layui-btn-primary" id="btn_cancel">返回</button>
                </div>
            </div>
        </form>
    </div>
</div>


<div class="table_div">
    <div class="table_div">
        <div id="searchParam" shiro:hasPermission="spottableZrzsNew:list">
            <form class="layui-form " action="" lay-filter="info">
                <div class="layui-form-item">
                    <div class="layui-fluid">
                        <div class="layui-row">
                            <div class="layui-form-item" id="area-pic">
                                <div class="layui-form-label" style="display: none">所在省/隐藏项</div>
                                <div class="layui-input-inline" style="width: 200px; display: none">
                                    <select name="pro" class="pro-selector" data-value="辽宁省" lay-filter="pro-1"
                                            style="display:none">
                                        <option value="">请选择省</option>
                                    </select>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">矿区所在市</label>
                                    <div class="layui-input-inline">
                                        <select name="ZS" class="ZS-selector" data-value="" lay-filter="ZS-1">
                                            <option value="">请选择市</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">矿区所在县</label>
                                    <div class="layui-input-inline">
                                        <select name="ZX" class="ZX-selector" data-value=" " lay-filter="ZX-1">
                                            <option value="">请选择县/区</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <button class="layui-btn" lay-submit lay-filter="fsjl"><i
                                                class="layui-icon layui-icon-search"></i>查询
                                        </button>
                                        <button type="reset" class="layui-btn layui-btn-primary"><i
                                                class="layui-icon layui-icon-refresh"></i>重置
                                        </button>
                                        <button class="layui-btn layui-btn-normal more-btn" lay-filter="more"><i
                                                class="layui-icon layui-icon-addition"></i>展开
                                        </button>
                                    </div>
                                </div>
                            </div>
                            <div class="more-container">
                                <div class="layui-inline">
                                    <label class="layui-form-label">核查单位</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="content" class="layui-input" id="content"
                                               placeholder="请输入核查单位">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">核查人员</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="hCRY" placeholder="请输入核查人员姓名" autocomplete="off"
                                               class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">单位名称</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="mobile" class="layui-input" id="mobile"
                                               placeholder="请输入单位名称">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">损毁类型</label>
                                    <div class="layui-input-inline">
                                        <select id="key-sHLX" name="sHLX" class="layui-select" lay-filter="">
                                            <option value="">请选择损毁类型</option>
                                            <option value="01">挖损</option>
                                            <option value="02">压占</option>
                                            <option value="03">塌陷</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">图斑属性</label>
                                    <div class="layui-input-inline">
                                        <input type="tBSX" id="key-tBSX" name="key-tBSX" hidden/>
                                        <select class="layui-form-select" lay-filter="">
                                            <option value="">请选择图斑属性</option>
                                            <option value="01">露天矿场</option>
                                            <option value="02">堆煤场</option>
                                            <option value="03">洗煤厂</option>
                                            <option value="04">煤矸石堆</option>
                                            <option value="05">其他矿石堆场</option>
                                            <option value="06">选矿厂</option>
                                            <option value="07">选矿池</option>
                                            <option value="08">表土堆</option>
                                            <option value="09">内排土场</option>
                                            <option value="10">外排土场</option>
                                            <option value="11">废石堆</option>
                                            <option value="12">尾矿库</option>
                                            <option value="13">山建筑</option>
                                            <option value="14">塌陷坑</option>
                                            <option value="15">地裂缝</option>
                                            <option value="16">崩塌</option>
                                            <option value="17">滑坡</option>
                                            <option value="18">其他</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">所有权权属</label>
                                    <div class="layui-input-inline">
                                        <input id="key-sHYQ" name="key-sHYQ" hidden/>
                                        <select class="layui-select" lay-filter="select-sHYQ">
                                            <option value="">请选择所有权权属</option>
                                            <option value="A">国有土地所有权</option>
                                            <option value="B">集体土地所有权</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">使用权权属</label>
                                    <div class="layui-input-inline">
                                        <input id="key-sYQ" name="key-sYQ" hidden/>
                                        <select class="layui-select" lay-filter="select-sYQ">
                                            <option value="">请选择使用权权属</option>
                                            <option value="A">国有土地使用权</option>
                                            <option value="B">集体土地使用权</option>
                                            <option value="C">其他</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">修复情况</label>
                                    <div class="layui-input-inline">
                                        <input id="key-zLQK" name="key-zLQK" hidden/>
                                        <select class="layui-select" lay-filter="">
                                            <option value="">请选择修复情况</option>
                                            <option value="A">未修复</option>
                                            <option value="B">正在修复</option>
                                            <option value="C">已修复完成</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">责任主体</label>
                                    <div class="layui-input-inline">
                                        <input type="text" id="key-zRZT" name="key-zRZT" placeholder="请输入责任主体"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div>
        <table class="layui-table" id="showTable" lay-filter="showTable"></table>
    </div>
    <script type="text/html" id="toolbar">
        <div class="layui-btn-container">
            <button class="layui-btn layui-btn-sm" lay-event="add" shiro:hasPermission="spottableZrzsNew:add">添加
            </button>
            <button class="layui-btn layui-btn-sm" lay-event="batchDeleted"
                    shiro:hasPermission="spottableZrzsNew:delete">删除
            </button>
        </div>
    </script>
    <script type="text/html" id="tool">
        <a class="layui-btn layui-btn-xs" lay-event="location">定位</a>
        <a class="layui-btn layui-btn-xs" lay-event="uploadImage">现场图片</a>
        <a class="layui-btn layui-btn-xs" lay-event="edit" shiro:hasPermission="spottableZrzsNew:update">编辑</a>
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"
           shiro:hasPermission="spottableZrzsNew:delete">删除</a>
    </script>

</body>
</html>
<script src="../layui/layui.all.js"></script>
<script src="../js/core.util.js"></script>
<script src="../mods/layarea.js"></script>
<script src="../mods/laytype.js"></script>
<script>
    //获取token
    var token = CoreUtil.getData("access_token");
    //地址栏转义token中的#号
    var tokenQuery = token.replace("#", "%23");
    var tableIns1;
    var table = layui.table;
    var form = layui.form;
    var layer = layui.layer;
    var $ = jQuery = layui.jquery;
    var laydate = layui.laydate;
    layui.config({
        base: '../mods/'
        , version: '1.0'
    });
    layui.use(['table', 'layer', 'laydate', 'form', 'layarea', 'laytype'], function () {
        var layer = layui.layer
            , form = layui.form
            , layarea = layui.layarea
            , laytype = layui.laytype;

        layarea.render({
            elem: '#area-picker',
            change: function (res) {
                //选择结果
                console.log(res);
            }
        });

        laytype.render({
            elem: '#area-type',
            change: function (res) {
                //选择结果
                console.log(res);
            }
        });
        //加载table
        var today = (new Date()).toLocaleDateString();
        laydate.render({
            elem: "#hCRQ",
            min: today,
            max: '2080-10-14',
            type: 'date',
            done: function (value, date, endDate) {

            }
        });
        laydate.render({
            elem: "#fKSJ",
            min: today,
            max: '2080-10-14',
            type: 'date',
            done: function (value, date, endDate) {

            }
        });
        laydate.render({
            elem: "#ySSJ",
            min: today,
            max: '2080-10-14',
            type: 'date',
            done: function (value, date, endDate) {

            }
        });
        form.verify({
            A: [/^(?!(0[0-9]{0,}$))[0-9]{1,}[.]{0,}[0-9]{0,}$/, '面积需为正数，请重新输入'],
            B: [/^[\S]{0,7}$/, '中心点纬度应不超过6位数字，且不能出现空格'],
            C: [/^[\S]{0,7}$/, '中心点纬度应不超过6位数字，且不能出现空格'],
            D: [/^(?!(0[0-9]{0,}$))[0-9]{1,}[.]{0,}[0-9]{0,}$/, '面积需为正数，请重新输入'],
            E: [/^(?!(0[0-9]{0,}$))[0-9]{1,}[.]{0,}[0-9]{0,}$/, '总投资额需为正数，请重新输入'],
        });
        tableIns1 = table.render({
            elem: '#showTable',
            height: "full-80",
            contentType: 'application/json'
            , headers: {"authorization": token}
            , page: true //开启分页
            , url: '../spottableZrzsNew/listByPage' //数据接口
            , method: 'POST'
            , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": CoreUtil.isEmpty(res.data) ? 0 : res.data.total, //解析数据长度
                    "data": CoreUtil.isEmpty(res.data) ? null : res.data.records //解析数据列表
                }
            },
            cols: [
                [
                    {type: 'checkbox', fixed: 'left', sort: true},
                    {fixed: 'left', width: 200, field: 'tBBH', title: '图斑编号', sort: true},
                    {field: 'xZS', width: 150, title: '矿区所在市', sort: true},
                    {field: 'xZX', width: 150, title: '矿区所在县', sort: true},
                    {field: 'hDMJ', width: 180, title: '土地损毁面积(m²)', sort: true},
                    {field: 'wZ', width: 200, title: '图斑位置', sort: true,},
                    {field: 'kFX', width: 150, title: '中心点经度', sort: true,},
                    {field: 'kFY', width: 150, title: '中心点纬度', sort: true,},
                    {field: 'fKYWR', width: 150, title: '复垦义务人', sort: true},
                    {
                        field: 'sTWT', width: 150, title: '损毁原因', sort: true, templet: function (d) {
                            if (d.sTWT == "TDSH") {
                                return "土地损毁";
                            } else if (d.sTWT == "DZHJWT") {
                                return "地质环境问题";
                            } else if (d.sTWT == "ZBPH") {
                                return "植被破坏";
                            }
                        }
                    },
                    {
                        field: 'zLQK', width: 150, title: '治理情况', sort: true, templet: function (d) {
                            if (d.zLQK == "WZL") {
                                return "未修复";
                            } else if (d.zLQK == "YHFZL") {
                                return "正在修复";
                            } else {
                                return "已修复完成";
                            }
                        }
                    },
                    {field: 'zLMJ', width: 150, title: '治理面积', sort: true},
                    {field: 'nXFSJ', width: 200, title: '拟修复时间', sort: true},
                    {field: 'xCZP', width: 150, title: '现场照片', sort: true},
                    {field: 'hCDW', width: 150, title: '核查单位名称', sort: true},
                    {field: 'hCRY', width: 150, title: '核查人员姓名', sort: true},
                    {field: 'hCRQ', width: 200, title: '核查具体日期', sort: true},
                    {field: 'sSZT', width: 150, title: '实施主体', sort: true},
                    {field: 'fKSJ', width: 200, title: '复垦/治理时间', sort: true},
                    {field: 'ySSJ', width: 200, title: '验收时间', sort: true},
                    {field: 'ySDW', width: 150, title: '组织验收单位', sort: true},
                    {
                        field: 'ySJL', width: 150, title: '验收结论', sort: true, templet: function (d) {
                            if (d.ySJL == "TG") {
                                return "通过";
                            } else if (d.ySJL == "YTJTG") {
                                return "有条件通过";
                            } else if (d.ySJL == "WTG") {
                                return "未通过";
                            } else {
                                return d.ySJL;
                            }
                        }
                    },
                    {field: 'fKFX', width: 300, title: '治理/复垦后土地利用类型', sort: true},
                    {field: 'zTTZ', width: 200, title: '总体投资（万元）', sort: true},
                    {fixed: 'right', width: 360, toolbar: "#tool", title: '操作'}
                ]
            ],
            toolbar: '#toolbar',
            done: function (res, curr, count) {
                // 该方法用于解决,使用fixed固定列后,行高和其他列不一致的问题
                $(".layui-table-body tr").each(function (index, val) {
                    $($(".layui-table-fixed .layui-table-body tbody tr")[index]).height($(val).height());
                });
                $(".layui-table-header  tr").each(function (index, val) {
                    $($(".layui-table-fixed .layui-table-header table tr")[index]).height($(val).height());
                });
            }
        });


        //表头工具
        table.on('toolbar(showTable)', function (obj) {
            switch (obj.event) {
                case 'batchDeleted':
                    var checkStatus = table.checkStatus(obj.config.id);
                    var data = checkStatus.data;
                    if (data.length == 0) {
                        layer.msg("请选择要批量删除的列");
                    } else {
                        var ids = [];
                        $(data).each(function (index, item) {
                            ids.push(item.tBBH);
                        });
                        tipDialog(ids);
                    }
                    break;
                case 'add':
                    $(".operation input[name=tBBH]").val("");
                    $(".operation input[name=hDMJ]").val("");
                    $(".operation input[name=zLQK]").val("");
                    $(".operation input[name=zLMJ]").val("");
                    $(".operation input[name=wZ]").val("");
                    $(".operation input[name=sTWT]").val("");
                    $(".operation input[name=fKYWR]").val("");
                    $(".operation input[name=xZS]").val("");
                    $(".operation input[name=xZX]").val("");
                    $(".operation input[name=nXFSJ]").val("");
                    $(".operation input[name=kFX]").val("");
                    $(".operation input[name=kFY]").val("");
                    $(".operation input[name=xCZP]").val("");
                    $(".operation input[name=hCDW]").val("");
                    $(".operation input[name=hCRY]").val("");
                    $(".operation input[name=hCRQ]").val("");
                    $(".operation input[name=sSZT]").val("");
                    $(".operation input[name=fKSJ]").val("");
                    $(".operation input[name=ySSJ]").val("");
                    $(".operation input[name=ySDW]").val("");
                    $(".operation input[name=ySJL]").val("");
                    $(".operation input[name=fKFX]").val("");
                    $(".operation input[name=zTTZ]").val("");
                    layer.open({
                        type: 1,
                        skin: 'layui-layer-lan',
                        title: "添加图斑",
                        shadeClose: true,
                        area: ['1050px', '500px'],
                        shade: 0.6,
                        maxmin: false,
                        anim: 1,
                        content: $('#picture'),
                        cancel: function () {
                        },
                    });
                    break;
            }
        });
        //列操作
        table.on('tool(showTable)', function (obj) {
            var data = obj.data;
            switch (obj.event) {
                case 'del':
                    var ids = [];
                    ids.push(data.tBBH);
                    tipDialog(ids);
                    break;
                case 'edit':
                    $(".operation input[name=tBBH]").val(data.tBBH);
                    $(".operation input[name=hDMJ]").val(data.hDMJ);
                    $(".operation input[name=zLQK]").val(data.zLQK);
                    $(".operation input[name=zLMJ]").val(data.zLMJ);
                    $(".operation input[name=sTWT]").val(data.sTWT);
                    $(".operation input[name=fKYWR]").val(data.fKYWR);
                    $(".operation input[name=wZ]").val(data.wZ);
                    $(".operation input[name=xZS]").val(data.xZS);
                    $(".operation input[name=xZX]").val(data.xZX);
                    $(".operation input[name=nXFSJ]").val(data.nXFSJ);
                    $(".operation input[name=kFX]").val(data.kFX);
                    $(".operation input[name=kFY]").val(data.kFY);
                    $(".operation input[name=xCZP]").val(data.xCZP);
                    $(".operation input[name=hCDW]").val(data.hCDW);
                    $(".operation input[name=hCRY]").val(data.hCRY);
                    $(".operation input[name=hCRQ]").val(data.hCRQ);
                    $(".operation input[name=sSZT]").val("");
                    $(".operation input[name=fKSJ]").val("");
                    $(".operation input[name=ySSJ]").val("");
                    $(".operation input[name=ySDW]").val("");
                    $(".operation input[name=ySJL]").val("");
                    $(".operation input[name=fKFX]").val("");
                    $(".operation input[name=zTTZ]").val("");
                    layer.open({
                        type: 1,
                        skin: 'layui-layer-lan',
                        title: "编辑信息",
                        shadeClose: true,
                        area: ['1050px', '500px'],
                        shade: 0.6,
                        maxmin: false,
                        anim: 1,
                        content: $('#picture'),
                        cancel: function () {
                        },
                    });
                    break;
                case 'uploadImage':
                    //自定页
                    layer.open({
                        title: '上传现场图片',
                        type: 2,
                        closeBtn: 1, //不显示关闭按钮
                        area: ['80%', '90%'],
                        anim: 2,
                        shadeClose: true, //开启遮罩关闭
                        content: CoreUtil.getContext() + '/spotfile/upload?tbbh=' + data.tBBH
                    });
                    break;
            }
        });

        $(".more-btn").click(function () {
            if ($(".more-container").is(":hidden")) {
                $(".more-container").show(); //如果元素为隐藏,则将它显现
                $(".more-btn").html('<i class="layui-icon layui-icon-subtraction"></i>收起')
            } else {
                $(".more-container").hide(); //如果元素为显现,则将其隐藏
                $(".more-btn").html('<i class="layui-icon layui-icon-addition"></i>展开')
            }
            return false;
        })
        //导出
        $('#export').on('click', function () {
            //原先分页limit
            var exportParams = {
                limit: 10000,
                key: $("#key").val()
            };
            CoreUtil.sendPost("/spottableZrzsNew/listByPage", exportParams, function (res) {
                //初始化渲染数据
                if (res.data != null && res.data.records != null) {
                    table.exportFile(tableIns1.config.id, res.data.records, 'xls');
                }
            });
        });

        //删除
        var tipDialog = function (ids) {
            layer.open({
                content: "确定要删除么?",
                yes: function (index, layero) {
                    layer.close(index); //如果设定了yes回调，需进行手工关闭
                    CoreUtil.sendDelete("/spottableZrzsNew/delete", ids, function (res) {
                        console.log(ids);
                        layer.msg(res.msg, {time: 1000}, function () {
                            search();
                        });
                    });
                }
            });
        };

        //返回
        $("#btn_cancel").click(function () {
            $(".table_div").show();
            $(".operation").hide();
            layer.closeAll();
            return false;
        });

        form.on('select(select-sTWT)', function (data) {
            $("#sTWT").val(data.value);
        });

        form.on('select(select-zLQK)', function (data) {
            $("#zLQK").val(data.value);
        });

        form.on('select(select-xZS)', function (data) {
            $("#xZS").val(data.value);
        });

        form.on('select(select-xZX)', function (data) {
            $("#xZX").val(data.value);
        });

        form.on('select(select-xFZT)', function (data) {
            $("#xFZT").val(data.value);
        });
        form.on('select(select-ySJL)', function (data) {
            $("#ySJL").val(data.value);
        });
        laydate.render({
            elem: "#nXFSJ",
            type: 'date',
            done: function (value, date, endDate) {

            }
        });
        laydate.render({
            elem: "#hCRQ",
            type: 'date',
            done: function (vaule, date, endDate) {

            }
        });


        //监听保存
        form.on('submit(submit)', function (data) {
            if (data.field.tBBH === undefined || data.field.tBBH === null || data.field.tBBH === "") {
                CoreUtil.sendPost("/spottableZrzsNew/add", data.field, function (res) {
                    console.log(data)
                    $(".table_div").show();
                    layer.msg('添加成功', {time: 1000},)
                    $(".operation").hide();
                    layer.closeAll();
                    search();
                });
            } else {
                CoreUtil.sendPut("/spottableZrzsNew/update", data.field, function (res) {
                    console.log(data)
                    $(".table_div").show();
                    layer.msg('修改成功', {time: 1000},)
                    $(".operation").hide();
                    layer.closeAll();
                    search();
                });
            }

            return false;
        });
    })
    ;

    //执行查询
    function search() {
        //这里以搜索为例
        tableIns1.reload({
            where: { //设定异步数据接口的额外参数，任意设
                TBBH: $("#key").val(),
            },
            page: {
                curr: 1 //重新从第 1 页开始
            }
        });
    }
</script>